package com.br.app.gae.bean;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class EMF {
	private  static EntityManagerFactory entityManagerFacory;
	private  static EntityManager entityManager;
	
	private EMF(){};
	
	public static EntityManagerFactory getInstance(){
		if (entityManagerFacory==null){
			entityManagerFacory = Persistence.createEntityManagerFactory("gae");
		}
		return entityManagerFacory;
	}
	
	public static EntityManager getEM(){
		if (entityManager==null){
			entityManager = Persistence.createEntityManagerFactory("gae").createEntityManager();
		}
		return entityManager;
	}
	
}
